﻿using SharpDX.Direct3D11;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Engine.Graphics.Shaders
{
    public class LoadBinShader
    {
        public LoadBinShader(string filename, Graphic engine)
        {
            System.Windows.Forms.MessageBox.Show("Just for testing something...");
            FileStream fs = new FileStream(filename, FileMode.Open);
            BinaryReader br = new BinaryReader(fs);

            byte[] byteArray = br.ReadBytes((int)br.BaseStream.Length);

            try
            {
                SharpDX.D3DCompiler.ShaderBytecode test = new SharpDX.D3DCompiler.ShaderBytecode(byteArray);
                var testt = test.Disassemble();
                StreamWriter sw = new StreamWriter(filename + ".txt");
                sw.Write(testt);
                sw.Close();

                //PixelShader ps = new PixelShader(engine.Device, test);
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.ToString()); ;
            }

            br.Close();
            fs.Close();
        }
    }

}
